﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Collections;
using FireFly;

namespace XAMLStylePad.ViewModels.TriggersAndSetters
{
    public abstract class TriggerViewModelBase<T> : XamlViewModelBase<T>, ITriggerViewModel where T : TriggerBase
    {
        public TriggerViewModelBase(T trigger): base(trigger)
        {
        }

        #region EnterActions
        public CollectionViewModel<TriggerAction, ObjectViewModel> EnterActions
        {
            get
            {
                if(_EnterActions == null)
                {
                    _EnterActions = new CollectionViewModel<TriggerAction, ObjectViewModel>(Model.EnterActions, o => new ObjectViewModel(o))
                    {
                        Parent = this,
                        DisplayName = "EnterActions"
                    };
                }
                return _EnterActions;
            }
        }
        CollectionViewModel<TriggerAction, ObjectViewModel> _EnterActions;
        #endregion

        #region ExitActions
        public CollectionViewModel<TriggerAction, ObjectViewModel> ExitActions
        {
            get
            {
                if(_ExitActions == null)
                {
                    _ExitActions = new CollectionViewModel<TriggerAction, ObjectViewModel>(Model.ExitActions, o => new ObjectViewModel(o))
                    {
                        Parent = this,
                        DisplayName = "ExitActions"
                    };
                }
                return _ExitActions;
            }
        }
        CollectionViewModel<TriggerAction, ObjectViewModel> _ExitActions;
        #endregion

        //#region RemoveCommand //remove commands for all trigger types have same caption
        //public new static RelayCommand<TriggerViewModelBase<T>> RemoveCommand
        //{
        //    get
        //    {
        //        if(_RemoveCommand == null)
        //        {
        //            _RemoveCommand = new CommonRemoveItemCommand<TriggerViewModelBase<T>> ("TriggerViewModelBase.RemoveCommand");
        //        }
        //        return _RemoveCommand;
        //    }
        //}
        //static RelayCommand<TriggerViewModelBase<T>> _RemoveCommand;
        //#endregion

        public override string DisplayName
        {
            get
            {
                throw new NotImplementedException();
            }
        }
    }
}
